﻿(function ($) {
	
	var start = new Date() ;

    $(function () {
    	//是否已登录
    	if(undefined != base.user_id && base.user_id.length > 0) {
    		$("#username").html(base.user_truename) ;
    	} else {
    		window.location.replace(base.contextPath+"/login.jsp") ; return ;
    	}
    	
    	try {
    		window.mainpage.instMainMenus();
            window.mainpage.instFavoMenus();
            window.mainpage.instTimerSpan();
            window.mainpage.bindNavTabsButtonEvent();
            window.mainpage.bindToolbarButtonEvent();
            window.mainpage.bindMainTabsButtonEvent();
            
            window.online.reload();
            
            var portal = $("#portal"), layout = $("#mainLayout"), navTabs = $("#navTabs"), themeCombo = $("#themeSelector");

            $.util.exec(function () {

                layout.removeClass("hidden").layout("resize");

                $("#maskContainer").remove();

                var size = $.util.windowSize();
                //判断当浏览器窗口宽度小于像素 1280 时，右侧 region-panel 自动收缩
                if (size.width < 1280) { layout.layout("collapse", "east"); }
                layout.layout("collapse", "east");
                
                window.func.projectInfo() ;
                window.func.weatherChart() ;
                window.func.toDaySchedule() ;
                window.func.systemNotice() ;
                
                var stop = new Date();
                alertify.warning("当前页面加载耗时(毫秒)："+$.date.diff(start, "ms", stop));
            });

    	} catch(err) {
    		alert(err);
    	}
    });
    
})(jQuery);